﻿@{
    ViewBag.Title = "Interviews";
    Layout = "~/Views/Front/MasterPage.cshtml";
}


<script language="javascript" type="text/javascript">
    function addOption(selectbox, text, value) {
        var optn = document.createElement("OPTION");
        optn.text = text;
        optn.value = value;
        selectbox.options.add(optn);
    }
    function AddOptionsList() {
        var selectbox = document.forms["InputForm"]["Interview"];
        for (var i = selectbox.length - 1; i > 0; i--)
            selectbox.remove(i);
        var jarrs;
        $.ajax({
            url: '@Url.Action("GetInterviews", "SmartTech")',
            async: false,
            success: function (msg) {
                jarrs = msg;
            }
        });
        var X = jarrs.split('|');
        //alert(X);
        var size = X[0];
        for (i = 1; i <= size * 2; i += 2) {
            addOption(selectbox, X[i + 1], X[i]);
        }
        if (jarrs == "")
            addOption(selectbox, "No available dates!", "No available dates!");
    }
</script>


<form action="@Url.Action("DeleteInterview", "SmartTech")" method="get" name="InputForm">
@{
    if(ViewBag.Errors != null)
    {
        <h4>@ViewBag.Errors</h4>
    }
}

<label>
    Interview :</label><br />
<select name="Interview" onfocus="AddOptionsList()">
    <option></option>
</select><br />
<button>Submit</button>
</form>